package com.chenyun.common.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * feign返回封装
 * @author: Lonni
 * @date: 2023/3/31 0031 17:00
 */
@AllArgsConstructor
@Data
@NoArgsConstructor
public class ServiceResponse<T> implements Serializable {
    private static final long serialVersionUID = 7838560704941794519L;


    private String msg;
    private Boolean success;
    private  T data;


    /**
     * 成功
     * @param data
     * @return
     * @param <T>
     */
    public  static  <T> ServiceResponse<T> success(T data){
        return new ServiceResponse<T>("",true,data);
    }

    public  static  <T> ServiceResponse<T> success(){
        return new ServiceResponse<T>("操作成功",true,null);
    }

    /**
     * 失败
     * @param msg
     * @return
     */
    public  static   ServiceResponse fail(String msg){
        return new ServiceResponse(msg,false,null);
    }













}



